package com.aikg.kgrag_java.pojo.entity;

import co.elastic.clients.elasticsearch._types.mapping.Property;
import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
import co.elastic.clients.elasticsearch.indices.IndexSettings;
import lombok.Data;
import java.util.Map;

@Data
public class IndexEntity {

    private String numberOfShards;

    private String numberOfReplicas;

    private Map<String, Property> properties;

    public TypeMapping.Builder buildMapping() {
        TypeMapping.Builder mappingBuilder = new TypeMapping.Builder();
        mappingBuilder.properties(properties);
        return mappingBuilder;
    }

    public IndexEntity(String numberOfShards, String numberOfReplicas,Map<String, Property> properties) {
        this.numberOfShards = numberOfShards;
        this.numberOfReplicas = numberOfReplicas;
        this.properties = properties;
    }

    public IndexSettings.Builder buildSettings() {
        return new IndexSettings.Builder()
                .numberOfShards(numberOfShards)
                .numberOfReplicas(numberOfReplicas);
    }

}
